//
//  SEGParkChildCommentCell.m
//  Pods
//
//  Created by Clavis on 2020/12/1.
//

#import "SEGParkChildCommentCell.h"

@interface SEGParkChildCommentCell ()

@property (nonatomic, strong) UIView *userInfoView;
@property (nonatomic, strong) UIImageView *userHeadImageView; // 用户头像
@property (nonatomic, strong) UILabel *userNameLabel; // 用户名称
@property (nonatomic, strong) UILabel *userCommunityLabel; // 项目名称

@property (nonatomic, strong) SEGLabel* contentLabel; //内容
@property (nonatomic, strong) UIView *extraInfoView;
@property (nonatomic, strong) UILabel *timeLabel; //时间
@property (nonatomic, strong) SEGLabel *commentLabel; // 评论
@property (nonatomic, strong) SEGLabel *likeLabel; // 点赞
@property (nonatomic, strong) UIView* bottomLine;

/// 当前cell的indexPath
@property (nonatomic, strong) NSIndexPath *indexPath;
/// 评论图片视图
@property (nonatomic, strong) UIView *morePictureView;
/// 子评论视图
@property (nonatomic, strong) UIView *childCommentsView;
/// 用户ID
@property (nonatomic, copy)NSString *userId;


@end

@implementation SEGParkChildCommentCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    self.backgroundColor = kColor_W;
    self.userInteractionEnabled = YES;
    
    //用户信息部分
    self.userInfoView = [[UIView alloc] init];
    [self.contentView addSubview: self.userInfoView];
    [self.userInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.equalTo(self.contentView);
        make.height.mas_equalTo(50);
    }];
    
    self.userHeadImageView = ({
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        imageView.clipsToBounds = YES;
        imageView.layer.cornerRadius = 25;
        [self.userInfoView addSubview:imageView];
        imageView;
    });
    [self.userHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.mas_equalTo(0);
        make.width.height.mas_equalTo(50);
    }];
    
    self.userNameLabel = ({
        UILabel *label = [[UILabel alloc] init];
        label.textColor = kColor_1;
        label.font = kFont_16;
        [self.userInfoView addSubview:label];
        label;
    });
    [self.userNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.userHeadImageView.mas_right).mas_offset(15);
        make.top.equalTo(self.userHeadImageView.mas_top).mas_offset(8);
        make.right.mas_equalTo(0);;
    }];
    
    self.userCommunityLabel = ({
        UILabel *label = [[UILabel alloc] init];
        label.textColor = kColor_3;
        label.font = kFont_12;
        [self.userInfoView addSubview:label];
        label;
    });
    [self.userCommunityLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.userHeadImageView.mas_right).mas_offset(15);
        make.bottom.equalTo(self.userHeadImageView.mas_bottom).mas_offset(-4);
        make.right.mas_equalTo(0);;
    }];
    
    
    //内容
    self.contentLabel = [SEGLabel new];
    self.contentLabel.numberOfLines = 0;
    self.contentLabel.preferredMaxLayoutWidth = LYScreenWidth() - 90 - 25;
    self.contentLabel.userInteractionEnabled = NO;
    [self.contentView addSubview:self.contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker* make) {
        make.left.equalTo(self.contentView).offset(90);
        make.right.equalTo(self.contentView).offset(-25);
        make.top.equalTo(self.userInfoView.mas_bottom);
    }];
    
    
    // 图片
    self.morePictureView = [[UIView alloc] init];
    self.morePictureView.backgroundColor = kColor_W;
    [self.contentView addSubview:self.morePictureView];
    [self.morePictureView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.contentLabel);
        make.top.equalTo(self.contentLabel.mas_bottom);
    }];

    // 其他信息
    self.extraInfoView = [[UIView alloc] init];
    [self.contentView addSubview:self.extraInfoView];
    [self.extraInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.contentLabel);
        make.top.equalTo(self.morePictureView.mas_bottom);
        make.bottom.mas_equalTo(0);
        make.height.mas_equalTo(58);
    }];
    
    [self.extraInfoView addSubview:self.timeLabel];
    [self.extraInfoView addSubview:self.likeLabel];
    [self.extraInfoView addSubview:self.commentLabel];
    
    //时间
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.bottom.mas_equalTo(-25);
    }];
    
    //评论
    [self.commentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(0);
        make.bottom.equalTo(self.timeLabel);
    }];

    //点赞
    [self.likeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.commentLabel);
        make.right.equalTo(self.commentLabel.mas_left).offset(-30);
    }];
    
    self.childCommentsView = [[UIView alloc] init];
    self.childCommentsView.backgroundColor = kColor_bg;
    [self.contentView addSubview:self.childCommentsView];
    [self.childCommentsView mas_makeConstraints:^(MASConstraintMaker *make) {
        
    }];
    
//    if (DEBUG) {
//        self.userInfoView.layer.borderWidth = 1;
//        self.userInfoView.layer.borderColor = kSegRandomColor.CGColor;
//        
//        
//        self.extraInfoView.layer.borderWidth = 1;
//        self.extraInfoView.layer.borderColor = kSegRandomColor.CGColor;
//        
//        
//        self.contentLabel.layer.borderWidth = 1;
//        self.contentLabel.layer.borderColor = kSegRandomColor.CGColor;
//        
//        
//        self.morePictureView.layer.borderWidth = 1;
//        self.morePictureView.layer.borderColor = kSegRandomColor.CGColor;
//        
//    
//        self.layer.borderWidth = 1;
//        self.layer.borderColor = kSegRandomColor.CGColor;
//    }
}


#pragma make - 布局

- (void)updateCellWithStyle:(SEGParkCommentCellStyle)style {
    // 头像
    UIEdgeInsets headImageViewInsets = UIEdgeInsetsZero;
    // 内容
    self.contentLabel.numberOfLines = 0;
    UIEdgeInsets contentLabelInsets =  UIEdgeInsetsZero;
    // 其他信息
    CGFloat extraInfoViewHeight = 58;
    // 时间
    CGFloat timeLabelBottomMargin = 15;
    // 评论按钮
    self.commentLabel.hidden = NO;
    
    [self.likeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.commentLabel);
        make.right.equalTo(self.commentLabel.mas_left).offset(-30);
    }];
    
    switch (style) {
        case SEGParkForumCommentCellStyle: {
            // 论坛评论样式
            headImageViewInsets = UIEdgeInsetsMake(25, 20, 0, 0);
            contentLabelInsets = UIEdgeInsetsMake(20, 20, 0, 20);
            self.contentLabel.numberOfLines = 3;
            extraInfoViewHeight = 58;
            timeLabelBottomMargin = 25;
            break;
        }
        case SEGParkForumDetailMainCommentCellStyle: {
            // 论坛评论详情主评论样式
            headImageViewInsets = UIEdgeInsetsMake(38, 25, 0, 0);
            contentLabelInsets = UIEdgeInsetsMake(20, 25, 0, 25);
            extraInfoViewHeight = 58;
            timeLabelBottomMargin = 25;
            break;
        }
        case SEGParkForumtDetailReplyCelStyle: {
            // 论坛评论详情回复的样式
            headImageViewInsets = UIEdgeInsetsMake(15, 25, 0, 0);
            contentLabelInsets = UIEdgeInsetsMake(12, 90, 0, 25);
            extraInfoViewHeight = 36;
            timeLabelBottomMargin = 15;
            break;
        }
        case SEGParkActivityDetailCommentCellStyle: {
            // 活动详情评论样式
            headImageViewInsets = UIEdgeInsetsMake(15, 25, 0, 0);
            contentLabelInsets = UIEdgeInsetsMake(12, 90, 0, 25);
            extraInfoViewHeight = 36;
            timeLabelBottomMargin = 15;
            break;
        }
        case SEGParkCommentDetailMainCommentCellStyle: {
            // 评论详情主评论样式
            headImageViewInsets = UIEdgeInsetsMake(38, 25, 0, 0);
            contentLabelInsets = UIEdgeInsetsMake(20, 25, 0, 25);
            extraInfoViewHeight = 39;
            timeLabelBottomMargin = 15;
            break;
        }
        case SEGParkCommentDetailReplyCelStyle: {
            // 评论详情回复的样式
            headImageViewInsets = UIEdgeInsetsMake(15, 20, 0, 0);
            contentLabelInsets = UIEdgeInsetsMake(12, 90, 0, 25);
            extraInfoViewHeight = 36;
            timeLabelBottomMargin = 15;
            self.commentLabel.hidden = YES;
            [self.likeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.bottom.equalTo(self.commentLabel);
                make.right.equalTo(self.contentView).offset(-25);
            }];
            break;
        }
        default:
            break;
    }
    
    [self.userInfoView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.mas_offset(headImageViewInsets.top);
        make.left.mas_offset(headImageViewInsets.left);
        make.right.mas_offset(-headImageViewInsets.left);
    }];
    
    [self.contentLabel mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.userInfoView.mas_bottom).mas_offset(contentLabelInsets.top);
        make.left.equalTo(self.contentView).offset(contentLabelInsets.left);
        make.right.equalTo(self.contentView).offset(-contentLabelInsets.right);
    }];
    
    [self.extraInfoView mas_updateConstraints:^(MASConstraintMaker* make) {
        make.height.mas_equalTo(extraInfoViewHeight);
    }];
    
    [self.timeLabel mas_updateConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-timeLabelBottomMargin);
    }];
}

/// 更新评论内容
/// @param contentText 评论内容
- (void)updateCellContentText:(NSString *)contentText {
    NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:ValueToString(contentText)];
    text.yy_font = kFont_15;
    text.yy_color = kColor_1;
    text.yy_lineSpacing = 5;
    self.contentLabel.attributedText = text;
}

/// 更新用户信息视图
/// @param imageURL 头像URL
/// @param username username
/// @param communityName communityName
- (void)updateUserHeadViewWithImageURL:(NSString *)imageURL username:(NSString *)username communityName:(NSString *)communityName {
    // 用户信息
    [self.userHeadImageView setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kClientImageRootURL, imageURL]] placeholderImage:[UIImage imageWithContentsOfFile:SEGPicName(@"headimg82")]];
    self.userNameLabel.text = username;
    self.userCommunityLabel.text = @"";
    if (communityName > 0) {
        self.userCommunityLabel.text = [SEGUtils getShowAddressWithString:communityName];
    }
}

/// 更新cell额外信息
/// @param time time
/// @param commentTotal 评论数量
/// @param praiseTotal 点赞数量
/// @param isParise 是否点赞
- (void)updateCellExtraInfoWithTime:(NSString *)time commentTotal:(NSString *)commentTotal praiseTotal:(NSString *)praiseTotal isParise:(NSString *)isParise {
    time = ValueToString(time);
    commentTotal = ValueToString(commentTotal);
    praiseTotal = ValueToString(praiseTotal);
    isParise = ValueToString(isParise);
    
    // 时间
    self.timeLabel.text = [SEGUtils getShowDateWithTimer:time];
    //设置评论按钮
    [self seg_commentLabelWithContent:commentTotal];
    //设置点赞按钮
    [self seg_likeLabelWithContent:praiseTotal isLiked:[isParise isEqualToString:@"1"]];
}

/// 设置园区论坛列表Cell
/// @param model 园区论坛列表数据
/// @param indexPath indexPath
- (void)setupCellWithNeighbourhoodCommentModel:(SEGSharedNeihborhoodModel *)model indexPath:(NSIndexPath*)indexPath {
    self.indexPath = indexPath;
    
    // 用户信息
    [self updateUserHeadViewWithImageURL:model.user.icon username:model.user.nickName communityName:model.model.communityName];
    
    // 评论内容
    [self updateCellContentText:model.model.content];
    
    // 评论图片
    [self seg_setImagesWithPicArray:model.model.picturesArray];
    
    // 设置时间 点赞数量 评论数量
    NSString *time = [NSString stringWithFormat:@"%ld", ValueToString(model.model.time).longValue*1000];
    [self updateCellExtraInfoWithTime:time commentTotal:model.model.commentCount praiseTotal:model.model.praiseCount isParise:model.model.isPraise];
    
    // 更新Cell样式
    [self updateCellWithStyle:SEGParkForumCommentCellStyle];
}


/// 设置论坛详情顶部评论cell样式
/// @param model 论坛详情顶部数据
/// @param userModel userModel
/// @param indexPath indexPath
- (void)setupCellWithQuizDetailModel:(SEGFindQuizListByQuizTypeModel *)model userModel:(SEGSharedCommonUserModel *)userModel indexPath:(NSIndexPath*)indexPath {
    self.indexPath = indexPath;
    
    // 用户信息
    [self updateUserHeadViewWithImageURL:userModel.icon username:userModel.nickName communityName:model.communityName];
    
    // 评论内容
    [self updateCellContentText:model.quizContent];
    
    // 设置时间 点赞数量 评论数量
//    NSString *time = [NSString stringWithFormat:@"%ld", ValueToString(model.model.time).longValue*1000];
    [self updateCellExtraInfoWithTime:ValueToString(model.createTime) commentTotal:ValueToString(model.commentTotal) praiseTotal:ValueToString(model.praiseTotal) isParise:ValueToString(model.isParise)];
    
    // 更新Cell样式
    [self updateCellWithStyle:SEGParkForumDetailMainCommentCellStyle];
}


/// 设置论坛详情评论cell样式
/// @param model 论坛详情评论model
/// @param indexPath indexPath
- (void)setupCellWithNeighbourhoodDetailReplyModel:(SEGSharedCommentModel *)model indexPath:(NSIndexPath *)indexPath {
    self.indexPath = indexPath;
    
    // 用户信息
    [self updateUserHeadViewWithImageURL:model.user.icon username:model.user.nickName communityName:model.comment.communityName];
    
    // 评论内容
    [self updateCellContentText:model.comment.content];
    
    // 设置时间 点赞数量 评论数量
    NSString *time = [NSString stringWithFormat:@"%ld", ValueToString(model.comment.time).longValue*1000];
    [self updateCellExtraInfoWithTime:time commentTotal:ValueToString(@(model.comment.childComment.count)) praiseTotal:ValueToString(model.comment.praiseCount) isParise:ValueToString(model.comment.isPraise)];
    
    // 更新Cell样式
    [self updateCellWithStyle:SEGParkForumtDetailReplyCelStyle];
}


/**
 * 设置活动列表评论cell
 * @author Wendy
 * @param model  活动列表评论数据
 * @param indexPath  索引
 */
- (void)setupCellWithActivityCommentModel:(SEGActivityDetailCommentModel *)model indexPath:(NSIndexPath*)indexPath {
    self.indexPath = indexPath;
    
    // 用户信息
    [self updateUserHeadViewWithImageURL:model.ico username:model.userName communityName:model.communityName];
    
    // 评论内容
    [self updateCellContentText:model.quizContent];
    
    // 设置时间 点赞数量 评论数量
    [self updateCellExtraInfoWithTime:model.createTime commentTotal:model.commentTotal praiseTotal:model.praiseTotal isParise:model.isParise];
    
    // 更新Cell样式
    [self updateCellWithStyle:SEGParkActivityDetailCommentCellStyle];
}

/**
 * 设置活动评论详情界面的cell
 * @author Wendy
 * @param model  活动评论的回复数据
 * @param indexPath  索引
 */
- (void)setupCellWithActivityDetailMainCommentModel:(SEGActivityDetailCommentDetailModel *)model indexPath:(NSIndexPath*)indexPath {
    
    self.indexPath = indexPath;
    
    // 用户信息
    [self updateUserHeadViewWithImageURL:model.ico username:model.userName communityName:model.communityName];
    
    // 评论内容
    [self updateCellContentText:model.quizContent];
    
    // 设置时间 点赞数量 评论数量
    [self updateCellExtraInfoWithTime:model.createTime commentTotal:model.commentTotal praiseTotal:model.praiseTotal isParise:model.isParise];
    
    // 更新Cell样式
    [self updateCellWithStyle:SEGParkCommentDetailMainCommentCellStyle];
}

/**
 * 设置活动评论界面的回复cell
 * @author Wendy
 * @param model  活动评论的回复数据
 * @param indexPath  索引
 */
- (void)setupCellWithActivityCommentAnswerModel:(SEGActivityDetailCommentAnswModel *)model indexPath:(NSIndexPath*)indexPath {
    self.indexPath = indexPath;
    
    // 用户信息
    [self updateUserHeadViewWithImageURL:model.iconUrl username:model.answNick communityName:model.communityName];
    
    // 回复内容
    NSString *byReviewNick = @"";
    NSMutableString *contentString = [[NSMutableString alloc] initWithString:model.answContent];
    if (model.byReviewNick.length > 0) {
        byReviewNick = [NSString stringWithFormat:@"回复 %@：", model.byReviewNick];
    }
    [contentString insertString:byReviewNick atIndex:0];
    
    NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:contentString];
    text.yy_font = kFont_15;
    text.yy_color = kColor_1;
    text.yy_lineSpacing = 5;
    
    [text yy_setTextHighlightRange:NSMakeRange(0, [byReviewNick length])
                             color:kColor_3
                   backgroundColor:[UIColor clearColor]
                         tapAction:^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect){
                             
                         }];
    self.contentLabel.attributedText = text;
    
    // 设置时间 点赞数量 评论数量
    [self updateCellExtraInfoWithTime:model.createTime commentTotal:nil praiseTotal:model.pariseTotal isParise:model.isPraise];
    
    // 更新Cell样式
    [self updateCellWithStyle:SEGParkCommentDetailReplyCelStyle];
}

// 控件 commentLabel文本布局计算
-(void)seg_commentLabelWithContent:(NSString*)content {
    if(!content) return;
    if (content.integerValue == 0) {//数字为0不展示
        content = @"";
    }
    
    UIFont *font = kFont_13;
    UIColor *color = kColor_3;
    NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:content];
    text.yy_font = font;
    text.yy_color = color;
    text.yy_lineSpacing = 5;
    
    //按钮图片
    CGFloat padding = 4;
    if(content.length == 0) {//没有文字时不需要间距
        padding = 0;
    }
    UIImage *image = [UIImage imageWithContentsOfFile:SEGPicName(@"comment")];
    NSAttributedString *img = [SEGKitHelper segAttachmentWithImage:image FontSize:image.size.height contentInsets:UIEdgeInsetsMake(0, 0, 0, padding)];
    if (img) {
        [text insertAttributedString:img atIndex:0];
    }
    self.commentLabel.attributedText = text;
}

//控件likeLabel文本布局计算
-(void)seg_likeLabelWithContent:(NSString*)content isLiked:(BOOL)isLiked
{
    if(!content)return;
    if (content.integerValue <= 0) {//数字小于等于0不展示
        content = @"";
    }
    
    UIFont *font = kFont_13;
    UIColor *color = kColor_3;
    NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:content];
    text.yy_font = font;
    text.yy_color = color;
    //按钮图片
    CGFloat padding = 3;
    if(content.length == 0) {//没有文字时不需要间距
        padding = 0;
    }
    UIImage *image;
    if(isLiked) {//已点赞
        image = [UIImage imageWithContentsOfFile:SEGPicName(@"like_selection")];
    }else {
        image = [UIImage imageWithContentsOfFile:SEGPicName(@"like")];
    }
    NSAttributedString *img = [SEGKitHelper segAttachmentWithImage:image FontSize:image.size.height contentInsets:UIEdgeInsetsMake(0, 0, 0, padding)];//直接传字体大小会导致图片变形，传图片高度
    if (img) {
        [text insertAttributedString:img atIndex:0];
    }
    self.likeLabel.attributedText = text;
}

/// 设置评论图片
- (void)seg_setImagesWithPicArray:(NSArray *)picArray
{
    // 先清除子视图约束
    [self.morePictureView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull subview, NSUInteger idx, BOOL * _Nonnull stop) {
        [subview mas_remakeConstraints:^(MASConstraintMaker *make) { }];
    }];
    [self.morePictureView removeAllSubviews];
    
    
    CGFloat imagePadding = 7.5;
    CGFloat defaultTopMargin = 15;
    CGFloat imageHeight = floor((LYScreenWidth() - 60 - imagePadding*2)/3.0);
    
    NSUInteger countInRow;//一行最大图片个数
    if (picArray.count == 1) {
        countInRow = 1;
    }else if (picArray.count == 4) {
        countInRow = 2;
    }else {
        countInRow = 3;
    }
    
    CGFloat pictureViewHeight = ceil(picArray.count * 1.0 / countInRow) * (imageHeight + imagePadding) + defaultTopMargin - imagePadding;
    if (picArray.count == 0) {
        pictureViewHeight = 0;
    }
    [self.morePictureView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(pictureViewHeight);
    }];
    
    __weak typeof (self) weakSelf = self;
    [picArray enumerateObjectsUsingBlock:^(NSString *imageString, NSUInteger idx, BOOL * _Nonnull stop) {
        
        NSURL *url = [NSURL URLWithString:imageString];
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        imageView.layer.masksToBounds = YES;
        [imageView setImageWithURL:url placeholderImage:[UIImage imageWithContentsOfFile:SEGPicName(@"erweima")]];
        imageView.tag = 10 + idx;
        imageView.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithActionBlock:^(UITapGestureRecognizer*  _Nonnull sender) {
            if ([weakSelf.delegate respondsToSelector:@selector(parkChildCommentCellContentViewImageTapWithImageURLArray:selectImageView:selectedIndex:)]) {
                [weakSelf.delegate parkChildCommentCellContentViewImageTapWithImageURLArray:picArray selectImageView:sender.view selectedIndex:sender.view.tag-10];
            }
        }];
        [imageView addGestureRecognizer:tap2];
        [self.morePictureView addSubview:imageView];
        
        CGFloat leftPadding = (idx % countInRow) * (imageHeight + imagePadding);
        CGFloat topPadding = (idx / countInRow) * (imageHeight + imagePadding) + defaultTopMargin;
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.height.mas_equalTo(imageHeight);
            make.top.mas_equalTo(topPadding);
            make.left.mas_equalTo(leftPadding);
        }];
    }];
}

#pragma mark - Action

- (void)likeLabelTap {
    if (self.delegate && [self.delegate respondsToSelector:@selector(parkChildCommentCellPraiseButtonActionWithIndexPath:)]) {
        [self.delegate parkChildCommentCellPraiseButtonActionWithIndexPath:self.indexPath];
    }
}

#pragma mark - getter
- (SEGLabel *)likeLabel {
    if (!_likeLabel) {
        _likeLabel = [[SEGLabel alloc]init];
        _likeLabel.userInteractionEnabled = YES;
        _likeLabel.textAlignment = NSTextAlignmentLeft;
        _likeLabel.textVerticalAlignment = SEGTextVerticalAlignmentCenter;
        __weak typeof(self) _self = self;
        _likeLabel.textTapAction = ^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
            [_self likeLabelTap];
        };
        _likeLabel.font = kFont_13;
        _likeLabel.textColor = kColor_3;
    }
    return _likeLabel;
}

- (SEGLabel *)commentLabel
{
    if (!_commentLabel) {
        _commentLabel = [[SEGLabel alloc]init];
        _commentLabel.userInteractionEnabled = YES;
        _commentLabel.textAlignment = NSTextAlignmentLeft;
        _commentLabel.textVerticalAlignment = SEGTextVerticalAlignmentCenter;
        _commentLabel.font = kFont_13;
        _commentLabel.textColor = kColor_3;
    }
    return _commentLabel;
}

- (UILabel *)timeLabel
{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc] init];
        _timeLabel.textColor = kColor_3;
        _timeLabel.font = kFont_11;
    }
    return _timeLabel;
}

- (UIView *)morePictureView
{
    if (!_morePictureView){
        _morePictureView = [[UIView alloc] init];
        _morePictureView.userInteractionEnabled = YES;
    }
    return _morePictureView;
}

@end
